package com.coder4j.auth.mapper;

import com.coder4j.starter.mybatis.BaseMapper;
import com.coder4j.auth.entity.AuthRefEntity;
import org.apache.ibatis.annotations.Mapper;

import java.util.Arrays;
import java.util.List;

/**
 * 权限_关系
 *
 * @author keller
 * @date 2024-05-07 18:10:11
 */
@Mapper
public interface AuthRefMapper extends BaseMapper<AuthRefEntity> {
    /**
     * 默认查询条件
     *
     * @return
     */
    @Override
    default List<String> defaultCondition() {
        return Arrays.asList(
                " <if test = 'createId!=null'> AND create_id=#{createId} </if>",
                " <if test = 'updateId!=null'> AND update_id=#{updateId} </if>",
                " <if test = 'isDeleted!=null'> AND is_deleted=#{isDeleted} </if>",
                " <if test = 'type!=null'> AND type=#{type} </if>",
                " <if test = 'sourceId!=null'> AND source_id=#{sourceId} </if>",
                " <if test = 'targetId!=null'> AND target_id=#{targetId} </if>");
    }
}
